package com.aaa.backsystem.service.impl;

import com.aaa.backsystem.entity.Dept;
import com.aaa.backsystem.dao.DeptDao;
import com.aaa.backsystem.entity.LayUiTree;
import com.aaa.backsystem.service.DeptService;
import com.aaa.backsystem.util.DeptUtil;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 部门表 服务实现类
 * </p>
 *
 * @author gyc
 * @since 2020-07-23
 */
@Service
public class DeptServiceImpl extends ServiceImpl<DeptDao, Dept> implements DeptService {

    @Autowired
    private DeptDao deptDao;

    @Override
    public List<LayUiTree> findDepts() {
        List<Dept> deptList = deptDao.selectList(null);
        List<LayUiTree> layUiTrees = DeptUtil.fromMenuListToTreeList(deptList);
        return layUiTrees;
    }
}
